package com.hex.liyue.giftmodule.presenter;

import com.alibaba.fastjson.JSONArray;
import com.hex.liyue.commonmodule.manager.HttpManager;
import com.hex.liyue.commonmodule.manager.UserManager;
import com.hex.liyue.commonmodule.net.ResponseListener;
import com.hex.liyue.giftmodule.bean.HarverDetailsBean;
import com.hex.liyue.giftmodule.bean.HarvesGiftsBean;

/**
 * Created by WJ on 2016/6/28.
 */
public class ConfirmReceiptPresenter {
    private IConfirmReceiptView iConfirmReceiptView;

    public ConfirmReceiptPresenter(IConfirmReceiptView iConfirmReceiptView) {
        this.iConfirmReceiptView = iConfirmReceiptView;
    }

    public void gift_export(JSONArray jsonArray) {
        iConfirmReceiptView.showLod("加载中...");
        HttpManager.getInstance().gift_export(UserManager.getUserId(), jsonArray, UserManager.getDeliveryId(), new ResponseListener<HarverDetailsBean>() {
            @Override
            public void onSuccess(HarverDetailsBean harverDetailsBean) {
                iConfirmReceiptView.closeLod();
                iConfirmReceiptView.startHarvestGiftsDetailsActivity(harverDetailsBean);//进入收货详情
            }

            @Override
            public void onFailure(String responseresult) {
                iConfirmReceiptView.closeLod();
                iConfirmReceiptView.showT(responseresult);
            }
        });
    }
}
